import type { ProfileDetail, ProfileParams } from '@/types/member'
import { http, ajhttp } from '@/utils/http'

/**
 * 创建艺人订单
 */
export const confirmOrder = (data) => {
  return ajhttp({
      method: 'POST',
      url: `/customer/account/confirmOrder`,
      data
  })
}

/**
 * 获取直属下级团队列表
 */
export const coupons = (data: { search?: string, shop?: string, status?: number, page: number, limit: number }) => {
  return ajhttp({
    method: 'GET',
    url: '/customer/account/coupons',
    data
  })
}

/**
 * 获取直属下级团队列表
 */
export const teams = (data: { search?: string, parent?: number, page: number, limit: number }) => {
  return ajhttp({
    method: 'GET',
    url: '/customer/account/teams',
    data
  })
}

/**
 * 获取关注或粉丝列表, type = 0 表示customer的关注, type == 1 粉丝
 */
export const subscribes = (data: { customer: number, type: number, page: number, limit: number }) => {
  return ajhttp({
    method: 'GET',
    url: '/customer/account/subscribes',
    data
  })
}
/**
 * 切换 关注/取关
 */
export const toggleSubscribe = (customer: number) => {
  return ajhttp({
    method: 'POST',
    url: `/customer/account/toggleSubscribe?customer=${customer}`,
  })
}
/**
 * 检查指定customer是否被关注
 */
export const checkSubscribe = (customer: number) => {
  return ajhttp({
    method: 'GET',
    url: '/customer/account/checkSubscribe',
    data: {
      customer
    }
  })
}

/**
 * 创建业务订单
 */
export const confirmBizOrder = (data) => {
  return ajhttp({
    method: 'POST',
    url: '/customer/account/confirmBizOrder',
    data
  })
}

/**
 * 获取前端用户账户列表信息
 */
export const list = (data) => {
  return ajhttp({
    method: 'GET',
    url: '/customer/account/list',
    data
  })
}

/**
 * 获取个人信息
 */
export const getMemberProfileAPI = (data) => {
  return ajhttp({
    method: 'GET',
    url: '/customer/account/profile',
    data
  })
}

/**
 * 修改个人信息
 * @param data 请求体参数
 */
export const putMemberProfileAPI = (data) => {
  return ajhttp({
    method: 'POST',
    url: '/customer/account/save',
    data,
  })
}
